<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Title</title>
</head>
<body>
  <div id="outer">
      <span>innerHTML</span>
  </div>

  <div id="outer2">
      <span>innerText</span>
  </div>

  <div id="outer3"></div>

    <script>
        let outer = document.getElementById("outer");
        console.log(outer.innerHTML);//获取标签内所有的东西包括html标签


        let outer2 = document.getElementById("outer2");
        console.log(outer2.innerText); // 获取标签内部的文本内容.

        let str = '<h2>第一个span</h2>';
        let outer3 = document.getElementById("outer3");
        //设置
        //outer3.innerHTML = str;
        outer3.innerText = str;

    </script>
</body>
</html>